package thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

class Point{
    private double x;
    private double y;
    private double r;
    private double a;

    public static void makePointByXY(double x, double y){
        Point p = new Point();
        p.setX(x);
        p.setY(y);
    }

    public static void makePointByRA(double r, double a){
        Point p = new Point();
        p.setR(r);
        p.setA(a);
    }

    public void setX(double x){
        this.x = x;
    }
    public void setY(double y){
        this.y = y;
    }
    public void setR(double r){
        this.r = r;
    }
    public void setA(double a){
        this.a = a;
    }
}


public class ThreadDemo28 {
    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(4);

        for(int i = 0; i < 1000; i++){
            int n = i;
            service.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println("执行第 " + n + " 个任务，执行线程为" + Thread.currentThread().getName());
                }
            });
        }
    }
}
